﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ErpToCrm.Model;

namespace ErpToCrm.DataMapping
{
    public static class MappingService
    {
        public static List<CrmDataXS> MappingDataXS(List<ErpXS_Data> data)
        {
            List<CrmDataXS> list = new List<CrmDataXS>();
            data.ForEach(e =>
            {
                CrmDataXS temp = new CrmDataXS();
                temp.name = e.vpactname;

                temp.fcmc = e.pk_house;

                temp.erpkhmc = e.custname;

                temp.hth = e.vbargainnum;

                temp.qdrq = e.dsigndate;

                temp.htje = e.signmny;

                temp.erpsyr = e.owner;

                temp.zhtdj = e.nypricesign;

                temp.zshdj = e.ndiscountprice;

                temp.zjdj = e.nrentprice;

                temp.sjwyf = e.real_wyfee;

                temp.htsfydzc = e.htsfydzc;

                temp.htydrzsj = e.rztzdrzdate;

                temp.ydzcsj = e.ydzcdate;

                temp.wzcsfywyzr = e.wecsfywyze;

                temp.ydcqdjrq = e.ydcqdjdate;

                temp.jfsj = e.ydjfdate;

                temp.dzyxxy = e.is_sign_agm;

                temp.tsyjqrsj = e.specconfirmdate;

                temp.zsyjqrrq = e.confirmdate;

                temp.zsyjqrje = e.nytotalmnysign;

                temp.zsyjqrmj = e.nsignarea;

                temp.erpfczj = e.pk_house;

                // 2021-01-20
                temp.hrphtzj = e.pk_sign;

                temp.recordtype = "20206C4285C37FDPIQNu";

                temp.zsdb9 = e.psnname;

                temp.sftf = e.is_return == "Y" ? "是" : "否";

                temp.lastmodifydate = e.dr;

                temp.skgsmc = e.pk_corp;

                temp.khmc = e.pk_customer;

                temp.ownerid = e.pk_psnbasdoc;

                temp.istest = 1;

                // 小产证
                temp.textdef7 = e.textdef7;

                temp.textdef8 = e.textdef8;

                list.Add(temp);
            });

            return list;
        }

        public static List<CrmDataZL> MappingDataZL(List<ErpZL_Data> data)
        {
            List<CrmDataZL> list = new List<CrmDataZL>();
            data.ForEach(e =>
            {
                CrmDataZL temp = new CrmDataZL();
                temp.hrphtzj = e.pk_pact;

                temp.skgsmc = e.pk_corp;

                temp.name = e.vpactname;

                temp.fcmc = e.pk_house;

                temp.erpfczj = e.pk_house;

                temp.khmc = e.pk_customer;

                temp.erpkhmc = e.custname;

                temp.bh9 = e.vbargainnum;

                temp.qdrq = e.dsigndate;

                temp.zjze9 = e.signmny;

                temp.htksrq = e.dstart;

                temp.htjsrq = e.dend;

                temp.lastmodifydate = e.ts;

                temp.ownerid = e.owner;

                temp.zshdj9 = e.ndiscountprice;

                temp.wyfdj = e.real_wyfee;

                temp.ydzcrq = e.ydzcdate;

                temp.jzsj9 = e.ydjfdate;

                temp.tsyjqrsj = e.specconfirmdate;

                temp.zsyjqrrq = e.confirmdate;

                temp.zsyjqrje = e.nytotalmnysign;

                temp.zsyjqrmj = e.nsignarea;

                // 所有人（临时交差）
                temp.ownerid = e.owner;

                temp.istest = "1";



                list.Add(temp);
            });

            return list;
        }
    }
}
